home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume22 / gawk2.11 / part16 < prev    next >
Encoding:
Internet Message Format  |  1990-06-07  |  22.9 KB

  1. Subject:  v22i102:  GNU AWK, version 2.11, Part16/16
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: 2d7fcb95 97c1ef26 b19beaa4 31ff9b0b
  5.  
  6. Submitted-by: "Arnold D. Robbins" <arnold@unix.cc.emory.edu>
  7. Posting-number: Volume 22, Issue 102
  8. Archive-name: gawk2.11/part16
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # Contents:  ./README ./alloca.c ./array.c ./missing.d/strcase.c
  17. # Wrapped by rsalz@litchi.bbn.com on Wed Jun  6 12:25:02 1990
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. echo If this archive is complete, you will see the following message:
  20. echo '          "shar: End of archive 16 (of 16)."'
  21. if test -f './README' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'./README'\"
  23. else
  24.   echo shar: Extracting \"'./README'\" \(4506 characters\)
  25.   sed "s/^X//" >'./README' <<'END_OF_FILE'
  26. XREADME:
  27. X
  28. XThis is GNU Awk 2.11. It should be upwardly compatible with the
  29. XSystem V Release 4 awk.
  30. X
  31. XThis release is essentially a bug fix release.  The files have been
  32. Xrenamed and code moved around to organize things by function.  Gawk should
  33. Xalso be somewhat faster now.  More care has been given towards portability
  34. Xacross different Unix systems.  See the installation instructions, below.
  35. X
  36. XKnown problems are given in the PROBLEMS file.  Work to be done is
  37. Xdescribed briefly in the FUTURES file.
  38. X
  39. XThe gawk.texinfo included in this release has been revised; it should
  40. Xbe in sync with what the code does.  The man page should also be accurate,
  41. Xbut no promises there.
  42. X
  43. XCHANGES FROM 2.10
  44. X
  45. XUser visible changes:
  46. X    Compatibility mode is now obtained via new -c option.
  47. X    The new ANSI C \a and \x escapes are now a standard part of gawk
  48. X        as Unix nawk has picked them up.
  49. X    The new tolower() and toupper() functions are also standard.
  50. X    A new undocumented option, -nostalgia, has been added.
  51. X    Command line options have changed somewhat from 2.10.
  52. X        -v    is now    -V
  53. X        -V    is now    -C
  54. X        new -v for doing variable assignments before the BEGIN block.
  55. X        new -c for compatibility mode.
  56. X        new -a for awk style regexps (default)
  57. X        new -e for egrep style regexps, per the POSIX draft spec.
  58. X    Some more formats have been added to printf, ala nawk and ANSI C.
  59. X
  60. XOther changes (the hard stuff):
  61. X    All known bugs fixed.
  62. X    Still more memory leaks plugged.
  63. X    Lots of changes to improve performance and portability.
  64. X
  65. XPC users, you've been saved!
  66. X    As of patchlevel 1, we are now supplying MS-DOS "support."  Said
  67. X    support was generously provided by Kent Williams, who is now
  68. X    the contact person for it.  See below for his address.
  69. X
  70. XINSTALLATION:
  71. X
  72. XThe Makefile will need some tailoring.  Currently it is set up for
  73. Xa Sun running SunOS 4.x and gcc.  The changes to make in the Makefile are
  74. Xcommented and should be obvious.  Starting with 2.11, our intent has been
  75. Xto make the code conform to standards (ANSI, POSIX, SVID, in that order)
  76. Xwhenever possible, and to not penalize standard conforming systems.
  77. XWe have included substitute versions of routines not universally available.
  78. XSimply add the appropriate define for the missing feature(s) on your system.
  79. X
  80. XIf you have 4.2 or 4.3 BSD, you should add -DTMPNAM_MISSING since the
  81. Xversion of tmpnam on these systems won't accept a NULL pointer.
  82. XThis does not apply to 4.3-tahoe or the S5R[23] systems I have access to.
  83. XYou need this if gawk core dumps on something simple like 'BEGIN {print "hi"}'.
  84. X
  85. XIf you have neither bison nor yacc, use the awk.tab.c file here.  It was
  86. Xgenerated with bison, and should have no AT&T code in it.  (Note that
  87. Xmodifying awk.y without bison or yacc will be difficult, at best.  You might
  88. Xwant to get a copy of bison from the FSF too.)
  89. X
  90. XIf you have an MS-DOS system, use the stuff in pc.d.
  91. X
  92. XPRINTING THE MANUAL
  93. X
  94. XThe 'support' directory contains texinfo.tex 2.1, which will be necessary
  95. Xfor printing the manual, and the texindex.c program from the emacs distribution
  96. Xwhich is also necessary.  See the makefile for the steps needed to get a
  97. XDVI file from the manual.
  98. X
  99. XCAVEATS
  100. X
  101. XThe existence of a patchlevel.h file does *N*O*T* imply a commitment on
  102. Xour part to issue bug fixes or patches.  It is there in case we should
  103. Xdecide to do so.
  104. X
  105. XBUG REPORTS AND FIXES:
  106. X
  107. XPlease coordinate changes through David Trueman and/or Arnold Robbins.
  108. X
  109. XDavid Trueman
  110. XDepartment of Mathematics, Statistics and Computing Science,
  111. XDalhousie University, Halifax, Nova Scotia, Canada
  112. X
  113. XUUCP        {uunet utai watmath}!dalcs!david
  114. XINTERNET    david@cs.dal.ca
  115. X
  116. XArnold Robbins
  117. X1315 Kittredge Court, N.E.
  118. XAtlanta, GA, 30329-3539, USA
  119. X
  120. XINTERNET:    arnold@skeeve.atl.ga.us
  121. XUUCP:        { gatech, emory, emoryu1 }!skeeve!arnold
  122. X
  123. XIf you can't contact either of us, try Jay Fenlason, hack@prep.ai.mit.edu
  124. XAKA mit-eddie!prep!hack.  During odd hours he can sometimes be reached at
  125. X(617) 253-8975, which is an MIT phone in the middle of the corridor, so don't
  126. Xbe suprised if someone wierd answers, or if the person on the other end has
  127. Xnever heard of him.  (Direct them to the microvax about 10 feet to their left.)
  128. X
  129. XMS-DOS SUPPORT
  130. X
  131. XSupport for MSC 5.1 was supplied for 2.11 by Kent Williams, who can be
  132. Xreached at williams@umaxc.weeg.uiowa.edu.  It relies heavily on the
  133. Xearlier work done for 2.10 by Conrad Kwok and Scott Garfinkle.  Bug
  134. Xreports on the MS-DOS version should go to Kent.  Of course, if it's
  135. Xa generic bug, we want to hear about it too, but if it isn't reproducible
  136. Xunder Unix, we won't be as interested.
  137. END_OF_FILE
  138.   if test 4506 -ne `wc -c <'./README'`; then
  139.     echo shar: \"'./README'\" unpacked with wrong size!
  140.   fi
  141.   # end of './README'
  142. fi
  143. if test -f './alloca.c' -a "${1}" != "-c" ; then 
  144.   echo shar: Will not clobber existing file \"'./alloca.c'\"
  145. else
  146.   echo shar: Extracting \"'./alloca.c'\" \(5456 characters\)
  147.   sed "s/^X//" >'./alloca.c' <<'END_OF_FILE'
  148. X/*
  149. X    alloca -- (mostly) portable public-domain implementation -- D A Gwyn
  150. X
  151. X    last edit:    86/05/30    rms
  152. X       include config.h, since on VMS it renames some symbols.
  153. X       Use xmalloc instead of malloc.
  154. X
  155. X    This implementation of the PWB library alloca() function,
  156. X    which is used to allocate space off the run-time stack so
  157. X    that it is automatically reclaimed upon procedure exit, 
  158. X    was inspired by discussions with J. Q. Johnson of Cornell.
  159. X
  160. X    It should work under any C implementation that uses an
  161. X    actual procedure stack (as opposed to a linked list of
  162. X    frames).  There are some preprocessor constants that can
  163. X    be defined when compiling for your specific system, for
  164. X    improved efficiency; however, the defaults should be okay.
  165. X
  166. X    The general concept of this implementation is to keep
  167. X    track of all alloca()-allocated blocks, and reclaim any
  168. X    that are found to be deeper in the stack than the current
  169. X    invocation.  This heuristic does not reclaim storage as
  170. X    soon as it becomes invalid, but it will do so eventually.
  171. X
  172. X    As a special case, alloca(0) reclaims storage without
  173. X    allocating any.  It is a good idea to use alloca(0) in
  174. X    your main control loop, etc. to force garbage collection.
  175. X*/
  176. X#ifndef lint
  177. Xstatic char    SCCSid[] = "@(#)alloca.c    1.1";    /* for the "what" utility */
  178. X#endif
  179. X
  180. X#ifdef emacs
  181. X#include "config.h"
  182. X#ifdef static
  183. X/* actually, only want this if static is defined as ""
  184. X   -- this is for usg, in which emacs must undefine static
  185. X   in order to make unexec workable
  186. X   */
  187. X#ifndef STACK_DIRECTION
  188. Xyou
  189. Xlose
  190. X-- must know STACK_DIRECTION at compile-time
  191. X#endif /* STACK_DIRECTION undefined */
  192. X#endif /* static */
  193. X#endif /* emacs */
  194. X
  195. X#ifdef X3J11
  196. Xtypedef void    *pointer;        /* generic pointer type */
  197. X#else
  198. Xtypedef char    *pointer;        /* generic pointer type */
  199. X#endif
  200. X
  201. X#define    NULL    0            /* null pointer constant */
  202. X
  203. Xextern void    free();
  204. Xextern pointer    xmalloc();
  205. X
  206. X/*
  207. X    Define STACK_DIRECTION if you know the direction of stack
  208. X    growth for your system; otherwise it will be automatically
  209. X    deduced at run-time.
  210. X
  211. X    STACK_DIRECTION > 0 => grows toward higher addresses
  212. X    STACK_DIRECTION < 0 => grows toward lower addresses
  213. X    STACK_DIRECTION = 0 => direction of growth unknown
  214. X*/
  215. X
  216. X#ifndef STACK_DIRECTION
  217. X#define    STACK_DIRECTION    0        /* direction unknown */
  218. X#endif
  219. X
  220. X#if STACK_DIRECTION != 0
  221. X
  222. X#define    STACK_DIR    STACK_DIRECTION    /* known at compile-time */
  223. X
  224. X#else    /* STACK_DIRECTION == 0; need run-time code */
  225. X
  226. Xstatic int    stack_dir;        /* 1 or -1 once known */
  227. X#define    STACK_DIR    stack_dir
  228. X
  229. Xstatic void
  230. Xfind_stack_direction (/* void */)
  231. X{
  232. X  static char    *addr = NULL;    /* address of first
  233. X                   `dummy', once known */
  234. X  auto char    dummy;        /* to get stack address */
  235. X
  236. X  if (addr == NULL)
  237. X    {                /* initial entry */
  238. X      addr = &dummy;
  239. X
  240. X      find_stack_direction ();    /* recurse once */
  241. X    }
  242. X  else                /* second entry */
  243. X    if (&dummy > addr)
  244. X      stack_dir = 1;        /* stack grew upward */
  245. X    else
  246. X      stack_dir = -1;        /* stack grew downward */
  247. X}
  248. X
  249. X#endif    /* STACK_DIRECTION == 0 */
  250. X
  251. X/*
  252. X    An "alloca header" is used to:
  253. X    (a) chain together all alloca()ed blocks;
  254. X    (b) keep track of stack depth.
  255. X
  256. X    It is very important that sizeof(header) agree with malloc()
  257. X    alignment chunk size.  The following default should work okay.
  258. X*/
  259. X
  260. X#ifndef    ALIGN_SIZE
  261. X#define    ALIGN_SIZE    sizeof(double)
  262. X#endif
  263. X
  264. Xtypedef union hdr
  265. X{
  266. X  char    align[ALIGN_SIZE];    /* to force sizeof(header) */
  267. X  struct
  268. X    {
  269. X      union hdr *next;        /* for chaining headers */
  270. X      char *deep;        /* for stack depth measure */
  271. X    } h;
  272. X} header;
  273. X
  274. X/*
  275. X    alloca( size ) returns a pointer to at least `size' bytes of
  276. X    storage which will be automatically reclaimed upon exit from
  277. X    the procedure that called alloca().  Originally, this space
  278. X    was supposed to be taken from the current stack frame of the
  279. X    caller, but that method cannot be made to work for some
  280. X    implementations of C, for example under Gould's UTX/32.
  281. X*/
  282. X
  283. Xstatic header *last_alloca_header = NULL; /* -> last alloca header */
  284. X
  285. Xpointer
  286. Xalloca (size)            /* returns pointer to storage */
  287. X     unsigned    size;        /* # bytes to allocate */
  288. X{
  289. X  auto char    probe;        /* probes stack depth: */
  290. X  register char    *depth = &probe;
  291. X
  292. X#if STACK_DIRECTION == 0
  293. X  if (STACK_DIR == 0)        /* unknown growth direction */
  294. X    find_stack_direction ();
  295. X#endif
  296. X
  297. X                /* Reclaim garbage, defined as all alloca()ed storage that
  298. X                   was allocated from deeper in the stack than currently. */
  299. X
  300. X  {
  301. X    register header    *hp;    /* traverses linked list */
  302. X
  303. X    for (hp = last_alloca_header; hp != NULL;)
  304. X      if (STACK_DIR > 0 && hp->h.deep > depth
  305. X      || STACK_DIR < 0 && hp->h.deep < depth)
  306. X    {
  307. X      register header    *np = hp->h.next;
  308. X
  309. X      free ((pointer) hp);    /* collect garbage */
  310. X
  311. X      hp = np;        /* -> next header */
  312. X    }
  313. X      else
  314. X    break;            /* rest are not deeper */
  315. X
  316. X    last_alloca_header = hp;    /* -> last valid storage */
  317. X  }
  318. X
  319. X  if (size == 0)
  320. X    return NULL;        /* no allocation required */
  321. X
  322. X  /* Allocate combined header + user data storage. */
  323. X
  324. X  {
  325. X    register pointer    new = xmalloc (sizeof (header) + size);
  326. X    /* address of header */
  327. X
  328. X    ((header *)new)->h.next = last_alloca_header;
  329. X    ((header *)new)->h.deep = depth;
  330. X
  331. X    last_alloca_header = (header *)new;
  332. X
  333. X    /* User storage begins just after header. */
  334. X
  335. X    return (pointer)((char *)new + sizeof(header));
  336. X  }
  337. X}
  338. X
  339. Xpointer xmalloc(n)
  340. Xunsigned int n;
  341. X{
  342. X  extern pointer malloc();
  343. X  pointer cp;
  344. X  static char mesg[] = "xmalloc: no memory!\n";
  345. X
  346. X  cp = malloc(n);
  347. X  if (! cp) {
  348. X    write (2, mesg, sizeof(mesg) - 1);
  349. X    exit(1);
  350. X  }
  351. X  return cp;
  352. X}
  353. END_OF_FILE
  354.   if test 5456 -ne `wc -c <'./alloca.c'`; then
  355.     echo shar: \"'./alloca.c'\" unpacked with wrong size!
  356.   fi
  357.   # end of './alloca.c'
  358. fi
  359. if test -f './array.c' -a "${1}" != "-c" ; then 
  360.   echo shar: Will not clobber existing file \"'./array.c'\"
  361. else
  362.   echo shar: Extracting \"'./array.c'\" \(6106 characters\)
  363.   sed "s/^X//" >'./array.c' <<'END_OF_FILE'
  364. X/*
  365. X * array.c - routines for associative arrays.
  366. X */
  367. X
  368. X/* 
  369. X * Copyright (C) 1986, 1988, 1989 the Free Software Foundation, Inc.
  370. X * 
  371. X * This file is part of GAWK, the GNU implementation of the
  372. X * AWK Progamming Language.
  373. X * 
  374. X * GAWK is free software; you can redistribute it and/or modify
  375. X * it under the terms of the GNU General Public License as published by
  376. X * the Free Software Foundation; either version 1, or (at your option)
  377. X * any later version.
  378. X * 
  379. X * GAWK is distributed in the hope that it will be useful,
  380. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  381. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  382. X * GNU General Public License for more details.
  383. X * 
  384. X * You should have received a copy of the GNU General Public License
  385. X * along with GAWK; see the file COPYING.  If not, write to
  386. X * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  387. X */
  388. X
  389. X#include "awk.h"
  390. X
  391. X#ifdef DONTDEF
  392. Xint primes[] = {31, 61, 127, 257, 509, 1021, 2053, 4099, 8191, 16381};
  393. X#endif
  394. X
  395. X#define ASSOC_HASHSIZE 127
  396. X#define STIR_BITS(n) ((n) << 5 | (((n) >> 27) & 0x1f))
  397. X#define HASHSTEP(old, c) ((old << 1) + c)
  398. X#define MAKE_POS(v) (v & ~0x80000000)    /* make number positive */
  399. X
  400. XNODE *
  401. Xconcat_exp(tree)
  402. XNODE *tree;
  403. X{
  404. X    NODE *r;
  405. X    char *str;
  406. X    char *s;
  407. X    unsigned len;
  408. X    int offset;
  409. X    int subseplen;
  410. X    char *subsep;
  411. X
  412. X    if (tree->type != Node_expression_list)
  413. X        return force_string(tree_eval(tree));
  414. X    r = force_string(tree_eval(tree->lnode));
  415. X    if (tree->rnode == NULL)
  416. X        return r;
  417. X    subseplen = SUBSEP_node->lnode->stlen;
  418. X    subsep = SUBSEP_node->lnode->stptr;
  419. X    len = r->stlen + subseplen + 1;
  420. X    emalloc(str, char *, len, "concat_exp");
  421. X    memcpy(str, r->stptr, r->stlen+1);
  422. X    s = str + r->stlen;
  423. X    free_temp(r);
  424. X    tree = tree->rnode;
  425. X    while (tree) {
  426. X        if (subseplen == 1)
  427. X            *s++ = *subsep;
  428. X        else {
  429. X            memcpy(s, subsep, subseplen+1);
  430. X            s += subseplen;
  431. X        }
  432. X        r = force_string(tree_eval(tree->lnode));
  433. X        len += r->stlen + subseplen;
  434. X        offset = s - str;
  435. X        erealloc(str, char *, len, "concat_exp");
  436. X        s = str + offset;
  437. X        memcpy(s, r->stptr, r->stlen+1);
  438. X        s += r->stlen;
  439. X        free_temp(r);
  440. X        tree = tree->rnode;
  441. X    }
  442. X    r = tmp_string(str, s - str);
  443. X    free(str);
  444. X    return r;
  445. X}
  446. X
  447. X/* Flush all the values in symbol[] before doing a split() */
  448. Xvoid
  449. Xassoc_clear(symbol)
  450. XNODE *symbol;
  451. X{
  452. X    int i;
  453. X    NODE *bucket, *next;
  454. X
  455. X    if (symbol->var_array == 0)
  456. X        return;
  457. X    for (i = 0; i < ASSOC_HASHSIZE; i++) {
  458. X        for (bucket = symbol->var_array[i]; bucket; bucket = next) {
  459. X            next = bucket->ahnext;
  460. X            deref = bucket->ahname;
  461. X            do_deref();
  462. X            deref = bucket->ahvalue;
  463. X            do_deref();
  464. X            freenode(bucket);
  465. X        }
  466. X        symbol->var_array[i] = 0;
  467. X    }
  468. X}
  469. X
  470. X/*
  471. X * calculate the hash function of the string subs, also returning in *typtr
  472. X * the type (string or number) 
  473. X */
  474. Xstatic int
  475. Xhash_calc(subs)
  476. XNODE *subs;
  477. X{
  478. X    register int hash1 = 0, i;
  479. X
  480. X    subs = force_string(subs);
  481. X    for (i = 0; i < subs->stlen; i++)
  482. X        hash1 = HASHSTEP(hash1, subs->stptr[i]);
  483. X
  484. X    hash1 = MAKE_POS(STIR_BITS((int) hash1)) % ASSOC_HASHSIZE;
  485. X    return (hash1);
  486. X}
  487. X
  488. X/*
  489. X * locate symbol[subs], given hash of subs and type 
  490. X */
  491. Xstatic NODE *                /* NULL if not found */
  492. Xassoc_find(symbol, subs, hash1)
  493. XNODE *symbol, *subs;
  494. Xint hash1;
  495. X{
  496. X    register NODE *bucket;
  497. X
  498. X    for (bucket = symbol->var_array[hash1]; bucket; bucket = bucket->ahnext) {
  499. X        if (cmp_nodes(bucket->ahname, subs))
  500. X            continue;
  501. X        return bucket;
  502. X    }
  503. X    return NULL;
  504. X}
  505. X
  506. X/*
  507. X * test whether the array element symbol[subs] exists or not 
  508. X */
  509. Xint
  510. Xin_array(symbol, subs)
  511. XNODE *symbol, *subs;
  512. X{
  513. X    register int hash1;
  514. X
  515. X    if (symbol->type == Node_param_list)
  516. X        symbol = stack_ptr[symbol->param_cnt];
  517. X    if (symbol->var_array == 0)
  518. X        return 0;
  519. X    subs = concat_exp(subs);
  520. X    hash1 = hash_calc(subs);
  521. X    if (assoc_find(symbol, subs, hash1) == NULL) {
  522. X        free_temp(subs);
  523. X        return 0;
  524. X    } else {
  525. X        free_temp(subs);
  526. X        return 1;
  527. X    }
  528. X}
  529. X
  530. X/*
  531. X * SYMBOL is the address of the node (or other pointer) being dereferenced.
  532. X * SUBS is a number or string used as the subscript. 
  533. X *
  534. X * Find SYMBOL[SUBS] in the assoc array.  Install it with value "" if it
  535. X * isn't there. Returns a pointer ala get_lhs to where its value is stored 
  536. X */
  537. XNODE **
  538. Xassoc_lookup(symbol, subs)
  539. XNODE *symbol, *subs;
  540. X{
  541. X    register int hash1, i;
  542. X    register NODE *bucket;
  543. X
  544. X    hash1 = hash_calc(subs);
  545. X
  546. X    if (symbol->var_array == 0) {    /* this table really should grow
  547. X                     * dynamically */
  548. X        emalloc(symbol->var_array, NODE **, (sizeof(NODE *) *
  549. X            ASSOC_HASHSIZE), "assoc_lookup");
  550. X        for (i = 0; i < ASSOC_HASHSIZE; i++)
  551. X            symbol->var_array[i] = 0;
  552. X        symbol->type = Node_var_array;
  553. X    } else {
  554. X        bucket = assoc_find(symbol, subs, hash1);
  555. X        if (bucket != NULL) {
  556. X            free_temp(subs);
  557. X            return &(bucket->ahvalue);
  558. X        }
  559. X    }
  560. X    bucket = newnode(Node_ahash);
  561. X    bucket->ahname = dupnode(subs);
  562. X    bucket->ahvalue = Nnull_string;
  563. X    bucket->ahnext = symbol->var_array[hash1];
  564. X    symbol->var_array[hash1] = bucket;
  565. X    return &(bucket->ahvalue);
  566. X}
  567. X
  568. Xvoid
  569. Xdo_delete(symbol, tree)
  570. XNODE *symbol, *tree;
  571. X{
  572. X    register int hash1;
  573. X    register NODE *bucket, *last;
  574. X    NODE *subs;
  575. X
  576. X    if (symbol->var_array == 0)
  577. X        return;
  578. X    subs = concat_exp(tree);
  579. X    hash1 = hash_calc(subs);
  580. X
  581. X    last = NULL;
  582. X    for (bucket = symbol->var_array[hash1]; bucket; last = bucket, bucket = bucket->ahnext)
  583. X        if (cmp_nodes(bucket->ahname, subs) == 0)
  584. X            break;
  585. X    free_temp(subs);
  586. X    if (bucket == NULL)
  587. X        return;
  588. X    if (last)
  589. X        last->ahnext = bucket->ahnext;
  590. X    else
  591. X        symbol->var_array[hash1] = bucket->ahnext;
  592. X    deref = bucket->ahname;
  593. X    do_deref();
  594. X    deref = bucket->ahvalue;
  595. X    do_deref();
  596. X    freenode(bucket);
  597. X}
  598. X
  599. Xstruct search *
  600. Xassoc_scan(symbol)
  601. XNODE *symbol;
  602. X{
  603. X    struct search *lookat;
  604. X
  605. X    if (!symbol->var_array)
  606. X        return 0;
  607. X    emalloc(lookat, struct search *, sizeof(struct search), "assoc_scan");
  608. X    lookat->numleft = ASSOC_HASHSIZE;
  609. X    lookat->arr_ptr = symbol->var_array;
  610. X    lookat->bucket = symbol->var_array[0];
  611. X    return assoc_next(lookat);
  612. X}
  613. X
  614. Xstruct search *
  615. Xassoc_next(lookat)
  616. Xstruct search *lookat;
  617. X{
  618. X    for (; lookat->numleft; lookat->numleft--) {
  619. X        while (lookat->bucket != 0) {
  620. X            lookat->retval = lookat->bucket->ahname;
  621. X            lookat->bucket = lookat->bucket->ahnext;
  622. X            return lookat;
  623. X        }
  624. X        lookat->bucket = *++(lookat->arr_ptr);
  625. X    }
  626. X    free((char *) lookat);
  627. X    return 0;
  628. X}
  629. END_OF_FILE
  630.   if test 6106 -ne `wc -c <'./array.c'`; then
  631.     echo shar: \"'./array.c'\" unpacked with wrong size!
  632.   fi
  633.   # end of './array.c'
  634. fi
  635. if test -f './missing.d/strcase.c' -a "${1}" != "-c" ; then 
  636.   echo shar: Will not clobber existing file \"'./missing.d/strcase.c'\"
  637. else
  638.   echo shar: Extracting \"'./missing.d/strcase.c'\" \(3821 characters\)
  639.   sed "s/^X//" >'./missing.d/strcase.c' <<'END_OF_FILE'
  640. X/*
  641. X * Copyright (c) 1987 Regents of the University of California.
  642. X * All rights reserved.
  643. X *
  644. X * Redistribution and use in source and binary forms are permitted
  645. X * provided that the above copyright notice and this paragraph are
  646. X * duplicated in all such forms and that any documentation,
  647. X * advertising materials, and other materials related to such
  648. X * distribution and use acknowledge that the software was developed
  649. X * by the University of California, Berkeley.  The name of the
  650. X * University may not be used to endorse or promote products derived
  651. X * from this software without specific prior written permission.
  652. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  653. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  654. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  655. X */
  656. X
  657. X#if defined(LIBC_SCCS) && !defined(lint)
  658. Xstatic char sccsid[] = "@(#)strcasecmp.c    5.6 (Berkeley) 6/27/88";
  659. X#endif /* LIBC_SCCS and not lint */
  660. X
  661. X#ifndef USG
  662. X#include <sys/types.h>
  663. X#else
  664. X#define u_char unsigned char
  665. X#endif
  666. X
  667. X/*
  668. X * This array is designed for mapping upper and lower case letter
  669. X * together for a case independent comparison.  The mappings are
  670. X * based upon ascii character sequences.
  671. X */
  672. Xstatic u_char charmap[] = {
  673. X    '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
  674. X    '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
  675. X    '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
  676. X    '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
  677. X    '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
  678. X    '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
  679. X    '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
  680. X    '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
  681. X    '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
  682. X    '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
  683. X    '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
  684. X    '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
  685. X    '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
  686. X    '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
  687. X    '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
  688. X    '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
  689. X    '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
  690. X    '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
  691. X    '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
  692. X    '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
  693. X    '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
  694. X    '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
  695. X    '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
  696. X    '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
  697. X    '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
  698. X    '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
  699. X    '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
  700. X    '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337',
  701. X    '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
  702. X    '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
  703. X    '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
  704. X    '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
  705. X};
  706. X
  707. Xstrcasecmp(s1, s2)
  708. X    char *s1, *s2;
  709. X{
  710. X    register u_char    *cm = charmap,
  711. X            *us1 = (u_char *)s1,
  712. X            *us2 = (u_char *)s2;
  713. X
  714. X    while (cm[*us1] == cm[*us2++])
  715. X        if (*us1++ == '\0')
  716. X            return(0);
  717. X    return(cm[*us1] - cm[*--us2]);
  718. X}
  719. X
  720. Xstrncasecmp(s1, s2, n)
  721. X    char *s1, *s2;
  722. X    register int n;
  723. X{
  724. X    register u_char    *cm = charmap,
  725. X            *us1 = (u_char *)s1,
  726. X            *us2 = (u_char *)s2;
  727. X
  728. X    while (--n >= 0 && cm[*us1] == cm[*us2++])
  729. X        if (*us1++ == '\0')
  730. X            return(0);
  731. X    return(n < 0 ? 0 : cm[*us1] - cm[*--us2]);
  732. X}
  733. END_OF_FILE
  734.   if test 3821 -ne `wc -c <'./missing.d/strcase.c'`; then
  735.     echo shar: \"'./missing.d/strcase.c'\" unpacked with wrong size!
  736.   fi
  737.   # end of './missing.d/strcase.c'
  738. fi
  739. echo shar: End of archive 16 \(of 16\).
  740. cp /dev/null ark16isdone
  741. MISSING=""
  742. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
  743.     if test ! -f ark${I}isdone ; then
  744.     MISSING="${MISSING} ${I}"
  745.     fi
  746. done
  747. if test "${MISSING}" = "" ; then
  748.     echo You have unpacked all 16 archives.
  749.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  750. else
  751.     echo You still must unpack the following archives:
  752.     echo "        " ${MISSING}
  753. fi
  754. exit 0
  755. exit 0 # Just in case...
  756.